home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 7
/
Apprentice-Release7.iso
/
Source Code
/
Pascal
/
Snippets
/
PNL Libraries
/
Libraries
/
ODB Engine
/
ODBEngine.p
< prev
next >
Wrap
Text File
|
1996-10-20
|
4KB
|
131 lines
unit ODBEngine;
interface
{ © copyright 1996 UserLand Software, Inc. All Rights Reserved. }
uses
Types, Quickdraw, Files;
type
odbRef = Ptr;
type
odbBool = UInt16;
type
odbString = Str255;
odbDirection = (
nodirection, dir_up, dir_down, dir_left, dir_right,
dir_flatup, dir_flatdown, dir_tyd_7, dir_sorted,
dir_pageup, dir_pagedown, dir_pageleft, dir_pageright );
const
ctdirections = 12; { for arrays indexed on directions }
type
odbValueType = OSType;
const
unknownvaluetype = '????';
charvaluetype = 'char';
shortvaluetype = 'shor';
longvaluetype = 'long';
binaryvaluetype = 'data';
booleanvaluetype = 'bool';
tokenvaluetype = 'tokn';
datevaluetype = 'date';
addressvaluetype = 'addr';
codevaluetype = 'code';
extendedvaluetype = 'exte';
stringvaluetype = 'TEXT';
externalvaluetype = 'xtrn';
directionvaluetype = 'dir ';
string4valuetype = 'type';
pointvaluetype = 'QDpt';
rectvaluetype = 'qdrt';
patternvaluetype = 'tptn';
rgbvaluetype = 'cRGB';
fixedvaluetype = 'fixd';
singlevaluetype = 'sing';
doublevaluetype = 'doub';
objspecvaluetype = 'obj ';
filespecvaluetype = 'fss ';
aliasvaluetype = 'alis';
enumeratorvaluetype = 'enum';
listvaluetype = 'list';
recordvaluetype = 'reco';
outlinevaluetype = 'optx';
wptextvaluetype = 'wptx';
tablevaluetype = 'tabl';
scriptvaluetype = 'scpt';
menubarvaluetype = 'mbar';
picturevaluetype = 'pict';
type
odbValueData = record
case integer of
1: ( flvalue: odbBool );
2: ( chvalue: SignedByte );
3: ( intvalue: SInt16 );
4: ( longvalue: SInt32 );
5: ( datevalue: SInt32 );
6: ( dirvalue: odbDirection ); { possibly UInt16/UInt32? }
7: ( ostypevalue: OSType );
8: ( stringvalue: Handle );
9: ( addressvalue: Handle );
10: ( binaryvalue: Handle );
11: ( externalvalue: Handle );
12: ( pointvalue: Point );
13: ( rectvalue: ^^Handle );
14: ( patternvalue: ^^Pattern );
15: ( rgbvalue: ^^RGBColor );
16: ( fixedvalue: Fixed );
{ 17: ( singlevalue: float ); What is the pascal equivalent of Float? }
18: ( doublevalue: ^^double );
19: ( objspecvalue: Handle );
20: ( filespecvalue: FSSpecHandle );
21: ( aliasvalue: Handle ); { AliasHandle }
22: ( enumvalue: OSType );
23: ( listvalue: Handle );
24: ( recordvalue: Handle );
end;
type
odbValueRecord = record
valuetype: odbValueType;
data: odbValueData;
end;
function odbNewFile( filern: SInt16 ): odbBool;
function odbOpenFile( filern: SInt16; var odb: odbRef ): odbBool;
function odbSaveFile( odb: odbRef ): odbBool;
function odbCloseFile( odb: odbRef ): odbBool;
function odbDefined( odb: odbRef; const bspath: odbString ): odbBool;
function odbDelete( odb: odbRef; const bspath: odbString ): odbBool;
function odbGetType( odb: odbRef; const bspath: odbString; var typ: OSType ): odbBool;
function odbGetValue( odb: odbRef; const bspath: odbString; var value: odbValueRecord ): odbBool;
function odbSetValue( odb: odbRef; const bspath: odbString; var value: odbValueRecord ): odbBool;
function odbNewTable( odb: odbRef; const bspath: odbString ): odbBool;
function odbCountItems( odb: odbRef; const bspath: odbString; var count: SInt32 ): odbBool;
function odbGetNthItem( odb: odbRef; const bspath: odbString; n: SInt32; var bsname: odbString ): odbBool;
function odbGetModDate( odb: odbRef; const bspath: odbString; var date: SInt32 ): odbBool;
procedure odbDisposeValue( odb: odbRef; var value: odbValueRecord );
procedure odbGetError( var bs: odbString );
end.